<!--
 * @version: 
 * @Author: yu
 * @Date: 2023-06-26 16:27:07
 * @LastEditors: Andy
 * @LastEditTime: 2023-06-28 14:04:05
-->
<template>
    <div>
        <el-button class="mt20 mb20" type="primary" size="medium" @click="add">添加</el-button>

        <!-- 列表 -->
        <list @edit="edit"></list>


        <!-- 弹窗 -->
        <o-dialog ref="dialog" :info="info"></o-dialog>
    </div>
</template>
<script>
import list from './list.vue'
import oDialog from './dialog.vue'
export default {
    data() {
        return {
            info: {
                isShow: false,  //弹窗
                title: '',  //文字
                isAdd: true //true是增加  false是编辑
            }
        }
    },
    methods: {
        //添加出现弹窗
        add() {
            this.info.isShow = true
            this.info.title = '添加角色'
            this.info.isAdd = true
        },

        //编辑
        edit(id){
            this.info.isShow = true
            this.info.title = '编辑角色'
            this.info.isAdd = false
            this.$refs.dialog.getDetail(id)
        }
    },
    mounted() {
        document.title = this.$route.meta.title
    },
    watch: {},
    computed: {},
    filters: {},
    components: {
        list,
        oDialog
    }
}
</script>
<style scoped></style>